package app.redis;

import app.htby.utils.RedisUtils;
import redis.clients.jedis.Jedis;

public class TestRedisReconnectRunnable implements Runnable {

	String ip;
	String redisType;

	/**
	 * 
	 * @param ip
	 *            连接地址
	 * @param redisType
	 *            需要重连的类型
	 */
	public TestRedisReconnectRunnable(String ip, String redisType) {
		this.ip = ip;
		this.redisType = redisType;
	}

	@Override
	public void run() {

	}

	public void reconnDataPlus() {
		boolean flag = false;// 连接成功 标志
		while (!flag) {
			try {
				// 等待时间
				// Thread.sleep(RedisUtils.reconnectTime);
				Thread.sleep(3000);
				TestRedisClient.getInstance().getDataPlusJedis().sadd("testConn", "test");
				System.out.println(TestRedisClient.getInstance().getDataPlusJedis().isConnected());
				// 判断是否连接成功
				flag = TestRedisClient.getInstance().getDataPlusJedis().isConnected();
			} catch (InterruptedException e) {
				
				
			}
		}
	}


}
